package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.PaymentRecordsDao;
import cn.gson.springboot.model.mapper.PaymentRecordsMapper;
import cn.gson.springboot.model.pojos.PaymentRecords;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class PaymentRecordsService {
    @Autowired
    PaymentRecordsMapper payRecordsMapper;
    @Autowired
    PaymentRecordsDao payRecordsDao;

    public List<PaymentRecords> selectPaymentRecords(Integer value, Integer num,String payDate){
        return payRecordsMapper.selectPaymentRecords(value,num,payDate);
    }


    public List<PaymentRecords> selectPaymentRecordsByPurId(Integer purId){
        return payRecordsMapper.selectPaymentRecordsByPurId(purId);
    }

    public PaymentRecords selectPaymentRecordsById(Integer payId){
        return payRecordsMapper.selectPaymentRecordsById(payId);
    }
    public List<PaymentRecords> selectPaymentRecordsMonth(){
        return payRecordsMapper.selectPaymentRecordsMonth();
    }

    @Transactional(transactionManager = "transactionManager")
    public void savePaymentRecords(PaymentRecords pay){
        payRecordsDao.save(pay);
    }

    @Transactional(transactionManager = "transactionManager")
    public void deletePaymentRecords(Integer payId){
        payRecordsDao.deleteById(payId);
    }
}
